package com.itchen.hospital.mapper;

import com.itchen.hospital.pojo.Announcement;
import com.itchen.hospital.pojo.Params;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AnnouncementMapper {
    /**
     * 查询所有
     *
     * @return
     */
    List<Announcement> getAll();

    /**
     * 条件查询
     *
     * @param params
     * @return
     */
    List<Announcement> findBySearch(@Param("params") Params params);

    /**
     * 添加
     *
     * @param announcement
     */
    void add(Announcement announcement);

    /**
     * 修改
     *
     * @param announcement
     */
    void update(Announcement announcement);

    /**
     * 根据id删除
     *
     * @param id
     */
    @Delete("delete from announcement where id = #{id}")
    void delete(String id);

    /**
     * 根据id回显
     *
     * @param id
     * @return
     */
    @Select("select * from announcement where id = #{id}")
    Announcement findById(String id);
}
